<template>
  <div class="content" ref="content">
    <div class="table-default" v-if="tableData">
      <el-button type="primary" class="backBtn" @click="backHandler">返回</el-button>
      <hr />

      <div id="base" ref="base">
        <el-descriptions :column="2" border title="基本信息">
          <!-- <template v-for="(item, index) in descripList" :key="index"> -->
          <!-- <el-descriptions-item :label="item.label">{{ item.content }} {{ item }}</el-descriptions-item> -->
          <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="生产组织编码">{{ tableData.fprdorgid_number }}</el-descriptions-item>
          <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="生产组织名称">{{ tableData.fprdorgid_name }}</el-descriptions-item>
          <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="生产车间编码">{{ tableData.fworkshopid_number }}</el-descriptions-item>
          <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="生产车间名称">{{ tableData.fworkshopid_name }}</el-descriptions-item>
          <!-- </template> -->
        </el-descriptions>

        <template v-if="isMore">
          <el-descriptions :column="2" border>
            <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="工艺流程代码">{{ tableData.flow_code }}</el-descriptions-item>
            <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="工艺流程名称">{{ tableData.flow_name }}</el-descriptions-item>
            <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="物料编码">{{ tableData.fmaterialid }}</el-descriptions-item>
            <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="物料名称">{{ tableData.fmaterialname }}</el-descriptions-item>
          </el-descriptions>
        </template>

        <el-divider @click="getMore">
          <el-icon><ArrowDownBold /></el-icon>
        </el-divider>
      </div>


      <div id="details" ref="details">
        <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
          <el-tab-pane label="子项明细" name="details">
            <!-- <searchDetail :proID="tableData.id"></searchDetail> -->
          </el-tab-pane>
          <el-tab-pane label="模块2" name="second">
            <!-- <searchDetail :proID="tableData"></searchDetail> -->
          </el-tab-pane>
          <el-tab-pane label="模块3" name="third">Role</el-tab-pane>
          <el-tab-pane label="模块3" name="fourth">Task</el-tab-pane>
        </el-tabs>
      </div>
      <!-- </el-scrollbar> -->
    </div>
  </div>
</template>
<script lang="ts" setup>
import { computed, onMounted, ref, getCurrentInstance, nextTick } from 'vue'
import Create from './create.vue'
import { useGetList } from '/admin/composables/curd/useGetList'
import { useDestroy } from '/admin/composables/curd/useDestroy'
import { useOpen } from '/admin/composables/curd/useOpen'
import { useRouter, useRoute } from 'vue-router'
import { ArrowDownBold } from '@element-plus/icons-vue'
let { proxy } = getCurrentInstance()

const router = useRouter()
const route = useRoute()

const api = `promanagement/processflow/${route.query.id}`

const { data, query, search, reset, loading } = useGetList(api)
const { destroy, deleted } = useDestroy()
const { open, close, title, visible, id } = useOpen()

const tableData = computed(() => data.value?.data)

console.log('路由参数接收', route.query.id)

const backHandler = () => {
  router.push('/Promanagement/processflow')
}
const isMore = ref<boolean>(false)

const proID = ref(0)

const getMore = () => {
  console.log('获取更多')
  isMore.value = !isMore.value
}

const fmoentrystatus = ref({
  1: '未审核',
  2: '审核',
})

const scrollbarRef = ref()

const activeName = ref('details')
const base = ref(null)
const details = ref(null)
const content = ref()

const scrollTop = ref(0)

onMounted(() => {
  search()
  deleted(reset)
})
</script>

<style lang="css">
/* .content{
  border: 2px solid red;
 overflow:hidden;
} */
.backBtn {
  margin: 20px 10px;
}

h2 {
  font-weight: bold;
}
#base {
  margin-bottom: 30px;
  /* border: 2px solid green; */
}
#details {
  /* border: 2px solid pink; */
}

.tabs {
  padding: 10px 0 0;
  /* border: 2px solid #000; */
  z-index: 999;
  background-color: #fff;
  position: sticky;
  top: -15px;
}

.tagRow {
  display: inline-block;
  /* border: 1px solid #000; */
  margin: 20px 10px;
}

.tagRow ul {
  display: flex;
  border: 1px solid #eee;
}
.tagRow ul li {
  margin: 0 5px;
  /* border: 1px solid #eee; */
  padding: 5px 10px;
  /* border-radius: 5px; */
}
.active {
  background-color: #409eff;
  color: #fff;
}
.labelClassNAme {
  width: 130px;
}
.contentClassName {
  width: 170px;
}
</style>
